<blockquote class="layui-elem-quote quoteBox">
    <form class="layui-form">
        <div class="layui-row">
            <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
                <div class="layui-inline">
                    <div class="layui-input-inline">
                        <input type="text" class="layui-input searchVal" placeholder="请输入角色名称" id="name"/>
                    </div>
                </div>
                <@shiro.hasPermission name="core/role/index:query">
                <div class="layui-inline">
                    <button class="layui-btn layui-btn-sm" id="btnQuery" type="button">
                        <i class="layui-icon layui-icon-search"></i>查询
                    </button>
                </div>
                </@shiro.hasPermission>
                <@shiro.hasPermission name="core/role/index:add">
                <div class="layui-inline">
                    <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" id="btnAddPage">
                        <i class="layui-icon layui-icon-add-circle"></i>添加
                    </button>
                </div>
                </@shiro.hasPermission>
            </div>
        </div>
        <div id="demo"></div>
        <script id="view" type="text/html">
            <table class="layui-table">
                <thead>
                <tr>
                    <th style="width:30%">角色/菜单名称</th>
                    <th style="width:10%">角色标识/菜单地址</th>
                    <th style="width:10%">角色标识</th>
                    <th style="width:10%">创建人</th>
                    <th style="width:10%">创建时间</th>
                    <th style="width:10%">更新人</th>
                    <th style="width:10%">更新时间</th>
                    <th style="width:10%">操作</th>
                </tr>
                </thead>
                <tbody>
                {{# layui.each(d.rows,function(index,r){ }}
                <tr>
                    <td>
                        {{r.name}}
                    </td>
                    <td>{{r.data.url?r.data.url:""}}{{r.data.sign?r.data.sign:""}}</td>
                    <td>{{r.data.desc?r.data.desc:''}}</td>
                    <td>{{r.pid=="0"?r.data.creator:""}}</td>
                    <td>{{r.pid=="0"?r.data.createTime:""}}</td>
                    <td>{{r.pid=="0"?r.data.updateBy:""}}</td>
                    <td>{{r.pid=="0"?r.data.updateTime:""}}</td>
                    <td align="left">
                        {{#if(r.pid == "0"){}}
                        <@shiro.hasPermission name="core/role/index:update">
                        <a href="javascript:fn.edit()" class="layui-btn layui-btn-sm" lay-tips="编辑角色">
                            <i class="layui-icon layui-icon-edit"></i>
                        </a>
                        </@shiro.hasPermission>
                        <@shiro.hasPermission name="core/role/index:delete">
                        <a href="javascript:fn.del()" class="layui-btn layui-btn-sm layui-btn-danger"
                           lay-tips="删除角色">
                            <i class="layui-icon layui-icon-delete"></i>
                        </a>
                        </@shiro.hasPermission>
                        <@shiro.hasPermission name="core/role/index:addRoleMenu">
                        <a href="javascript:fn.addRoleMenu()" class="layui-btn layui-btn-sm layui-btn-warm"
                           lay-tips="添加角色菜单">
                            <i class="layui-icon layui-icon-add-1"></i>
                        </a>
                        </@shiro.hasPermission>
                        {{#} else { }}
                        {{#if (r.data.url!=null && r.data.url!=""){ }}
                        <@shiro.hasPermission name="core/role/index:addRoleMenuPermission">
                        <a href="javascript:fn.addRoleMenuPermission()" class="layui-btn layui-btn-sm layui-btn-warm"
                           lay-tips="添加角色菜单权限">
                            <i class="layui-icon layui-icon-add-circle"></i>
                        </a>
                        </@shiro.hasPermission>
                        {{#}}}
                        {{#}}}
                    </td>
                </tr>
                {{# }); }}
                </tbody>
            </table>
        </script>
    </form>
</blockquote>
<script>
    var fn = {};
    layui.config({
        base: '/static/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'core/role']);
</script>